//
//  YZDoctorBaseInfoViewController.m
//  kuaiyi
//
//  Created by WGP on 16/5/5.
//
//

#import "YZDoctorBaseInfoViewController.h"
#import "YZDoctorModel.h"
#import "YZDoctorBaseInfoView.h"
#import "YZDoctorBottomInfoView.h"
#import <Masonry.h>
#import "YZNetWorkTool.h"
#import "UIBarButtonItem+Extension.h"
#import "YZScrollView.h"
#import <SVProgressHUD.h>
#import <MBProgressHUD.h>
#import "YZSickerMessageViewController.h"

@interface YZDoctorBaseInfoViewController ()

@end

@implementation YZDoctorBaseInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"医生基本信息";
    self.view.backgroundColor = YZGrayColor;
    
    [self setupUI];
    
}

-(void)setupUI
{
     YZDoctorBaseInfoView *infoView = [[YZDoctorBaseInfoView alloc] init];
    infoView.doctorModel = self.doctorModel;
    [self.view addSubview:infoView];
    
    YZDoctorBottomInfoView *bottomView = [[YZDoctorBottomInfoView alloc] init];
    bottomView.scrollView.pushBlock = ^()
    {
//        push到有号控制器
//        [self.navigationController pushViewController:[[YZSickerMessageViewController alloc] init] animated:YES];
        [self.navigationController pushViewController:[YZSickerMessageViewController sickerMessageViewController:self.doctorModel] animated:YES];
    };
    bottomView.doctorModel = self.doctorModel;
    [self.view addSubview:bottomView];
    
    [infoView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(self.view);
        make.top.equalTo(self.view).offset(64);
        make.height.mas_equalTo(100);
    }];
    
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(infoView.mas_bottom).offset(10);
        make.left.right.bottom.equalTo(self.view);
    }];
    
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem customViewWith:@"star" target:self action:@selector(changeCollectStatue:)];
    
}

-(void)changeCollectStatue:(UIBarButtonItem *)btn
{
    UIButton *btnItem = (UIButton *)btn;
    btnItem.selected = !btnItem.selected;
    
    [SVProgressHUD setMinimumDismissTimeInterval:1];
    if (btnItem.selected) {
        
        [SVProgressHUD showInfoWithStatus:@"收藏成功"];
    }else
    {
        [SVProgressHUD showInfoWithStatus:@"取消收藏"];
    }
  
}

@end




